<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>流程任务配置列表</title>
<link href="../../static/plugin/easyui/themes/bootstrap/easyui.css" rel="stylesheet" type="text/css"/>
<link href="../../static/plugin/easyui/themes/icon.css" rel="stylesheet" type="text/css"/>
<script src="../../static/plugin/easyui/jquery.min.js" type="text/javascript"></script>
<script src="../../static/plugin/easyui/jquery.easyui.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../../static/plugin/easyui/locale/easyui-lang-zh_CN.js" type="text/javascript"></script>
<script src="../../static/plugin/assets/jslib.util.js" type="text/javascript"></script>
<script src="../../static/plugin/assets/jslib.jquery.ajax.js" type="text/javascript"></script>
<script src="../../static/plugin/assets/jslib.easyui.util.js" type="text/javascript"></script>
<script src="../../ffres/dict/all.js" type="text/javascript"></script>
<a href="" target="_blank" id="commonLink" name="commonLink"></a>
</head>
<script type="text/javascript">

	var batchId = "";
	$(function() {
		var params = JLEUtil.paramUrl2Obj(window.location.href);
		batchId = params.batchId;
		$('#dg').datagrid({
			singleSelect:true,
			collapsible:true,
			url:'../../api/bat/task/unit/configs',
			method:'post',
			toolbar: "#tb",
			rownumbers: true,
			pagination: true,
			pageSize: "20",
			queryParams: {
				batchId: params.batchId
			}
		});
	});

	function doAdd(){
		JLEUtil.createModalWin('新增', 'BatTaskUnitConfigAdd.html?' + 'batchId=' + batchId );
	}
	
	function doUpdate() {
		var row = $('#dg').datagrid('getSelected');
		if (row){
			JLEUtil.createModalWin('修改', 'BatTaskUnitConfigUpdate.html?' + 'taskId=' + row.taskId);
		} else {
			$.messager.alert('提示','请选择一条记录！','info');
		}
	}
	
	function doDelete(){
		var row = $('#dg').datagrid('getSelected');
		if (row) {
			$.messager.confirm('删除提示', '你确定要删除这条记录?', function(r){
				if (r){
					var jsonData = JSON.parse('{'+'"taskId":"' + row.taskId + '"'+'}');
					$.restfulDelete('../../api/bat/task/unit/config', jsonData, function(data) {
						$.messager.alert('提示','记录删除成功!','info');
						$('#dg').datagrid('reload');
					});
				}
			});
		} else {
			$.messager.alert('提示','请选择一条记录！','info');
		}
	}

	function doView(){
		var row = $('#dg').datagrid('getSelected');
		if (row) {
			JLEUtil.createModalWin('详情','BatTaskUnitConfigView.html?' + 'taskId=' + row.taskId);
		} else {
			$.messager.alert('提示','请选择一条记录！','info');
		}
	}	
	
	function doPluginConf(){
		var row = $('#dg').datagrid('getSelected');
		if (row) {
			var url = '../../api/plugin/define/' + row.pluginId;
			$.restfulGet(url, null, function(data) {
				JLUtil.linkNewPage(data.rows.pluginConfigUrl + '?pluginConfId=' + row.pluginParaFlag);
			}, function(data) {
				$.messager.alert('提示','没有找到该插件配置地址！','info');
			});
		} else {
			$.messager.alert('提示','请选择一条记录！','info');
		}
	}

	function reloadList(){
		$('#dg').datagrid('reload');
		JLEUtil.closewin();
	};	
	
</script>
</head>
<body class="easyui-layout">
<div data-options="region:'north',title:''" style="height: 40px; background: #F4F4F4;">
	<form id="searchForm">
		<table>
			<tr>
				<td>&nbsp;任务编号：</td>
				<td><input name="taskId" id="taskId"/></td>
				<td>&nbsp;任务名称：</td>
				<td><input name="taskName" id="taskName"/></td>
				<td>&nbsp;阶段编号：</td>
				<td><input name="stageId" id="stageId"/></td>
				<td>&nbsp;任务使用状态：</td>
				<td><select class="easyui-combobox"
					id="taskUseState" name="taskUseState"
					style="width: 100%; height: 25px;"
					data-options="editable:false,valueField:'enname',textField:'cnname',data:BAT_TASK_USE_STATE"></td>
				<td><a class="easyui-linkbutton" href="javascript:void(0);" onclick="JLEUtil.queryForm('searchForm','dg','../../api/bat/task/unit/configs');">查找</a></td>
				<td><a class="easyui-linkbutton" href="javascript:void(0);" onclick="JLEUtil.clearForm('searchForm');">清空</a></td>
			</tr>
		</table>
	</form>
</div>
<div data-options="region:'center',split:false">
<table id="dg" class="easyui-datagrid" title="" style="width:100%;height:100%" >
		<thead>
			<tr>
				<th data-options="field:'batchId',resizable:true" >流程标识</th>
				<th data-options="field:'taskId',resizable:true" >任务编号</th>
				<th data-options="field:'taskName',resizable:true" >任务名称</th>
				<th data-options="field:'taskRunType',resizable:true" formatter="formatter_BAT_TASK_RUN_TYPE">任务执行类型</th>
				<th data-options="field:'previousTaskId',resizable:true" >前置任务编号</th>
				<th data-options="field:'stageId',resizable:true" >阶段编号</th>
				<th data-options="field:'localeId',resizable:true" >执行场所编号</th>
				<th data-options="field:'pluginType',resizable:true" formatter="formatter_BAT_PLUGIN_TYPE">应用插件类型</th>
				<th data-options="field:'pluginId',resizable:true" >应用插件ID</th>
				<th data-options="field:'pluginSourceType',resizable:true" formatter="formatter_BAT_PLUGIN_SOURCE_TYPE">插件配置数据来源方式</th>
				<th data-options="field:'pluginParaFlag',resizable:true" >插件配置数据标识</th>
				<th data-options="field:'taskPri',resizable:true" >任务优先级</th>
				<th data-options="field:'taskUseState',resizable:true" formatter="formatter_BAT_TASK_USE_STATE">任务使用状态</th>
				<th data-options="field:'taskUseArea',resizable:true" formatter="formatter_BAT_TASK_USE_AREA">任务使用场景</th>
				<!--<th data-options="field:'taskCycleType',resizable:true" formatter="formatter_BAT_CYCLE_TYPE">任务周期类型</th>
				<th data-options="field:'taskCronValue',resizable:true" >任务定时周期</th>
				<th data-options="field:'taskDelayTime',resizable:true" >任务延时执行时间(秒)</th>
				<th data-options="field:'taskSkipTactic',resizable:true" formatter="formatter_BAT_TASK_SKIP_TACTIC">任务失败跳过策略</th>
				<th data-options="field:'againRunSpace',resizable:true" >任务重复调起时间间隔(秒)</th>
				<th data-options="field:'taskEstimateTime',resizable:true" >任务预计执行时间(秒)</th>
				<th data-options="field:'maxRunCount',resizable:true" >任务最大重复调起次数</th>
				<th data-options="field:'taskTimeoutTime',resizable:true" >任务运行超时时间(秒)</th>
				<th data-options="field:'taskTimeoutTactic',resizable:true" >任务运行超时策略</th>
				<th data-options="field:'subsDsCode',resizable:true" >分类数据源代码</th>
				<th data-options="field:'maxWaitTime',resizable:true" >最长等待时间</th>
				<th data-options="field:'cycleInteval',resizable:true" >轮询间隔(秒)</th>
				<th data-options="field:'remark',resizable:true" >备注</th> -->
			</tr>
		</thead>
	</table>
</div>
<div id="tb" style="padding:1px">
	<div style="margin-bottom:2px">
		<a href="javascript:doAdd()" class="easyui-linkbutton" iconCls="icon-add" plain="true">新增</a>
		<a href="javascript:doUpdate()" class="easyui-linkbutton" iconCls="icon-edit" plain="true">修改</a>
		<a href="javascript:doDelete()" class="easyui-linkbutton" iconCls="icon-remove" plain="true">删除</a>
		<a href="javascript:doView()" class="easyui-linkbutton" iconCls="icon-ok" plain="true">查看</a>
		<a href="javascript:doPluginConf()" class="easyui-linkbutton" iconCls="icon-ok" plain="true">插件参数配置</a>
	</div>
</div>
</body>
</html>
